//
//  myButton.m
//  bookKTVMerchant
//
//  Created by edz on 2019/7/20.
//  Copyright © 2019年 edz. All rights reserved.
//

#import "myButton.h"

@implementation myButton

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

-(void)setMyButtonIcon:(UIImage *)image TitileText:(NSString *)text TextFont:(CGFloat)font TitleColor:(UIColor *)textColor BackColoc:(UIColor *)backgroudColor{
    [self setImage:image forState:UIControlStateNormal];
    [self setTitle:text forState:UIControlStateNormal];
    [self.titleLabel setFont:[UIFont systemFontOfSize:font]];
    [self setTitleColor:textColor forState:UIControlStateNormal];
    [self setBackgroundColor:backgroudColor];
    
}
//设置文字在右边图片在左边
-(void)creatLeftTextRightButton:(NSString *)buttonText butttonClolr:(UIColor *)buttoncolor ButtonFont:(CGFloat)buttonfont imageName:(NSString *)imagename{
    [self setTitle:buttonText forState:UIControlStateNormal];
    //图片
    UIImage *imageBtn02 = [UIImage imageNamed:imagename];
    [self setImage:imageBtn02 forState:UIControlStateNormal];
    
    [self setTitleColor:buttoncolor forState:UIControlStateNormal];
    // 取出 titleLabel 的宽度
    CGFloat labelWidth02 = self.titleLabel.bounds.size.width;
    // 取出 imageView 的宽度
    CGFloat imageWidth02 = self.imageView.bounds.size.width;
    // 设置 titleLabel 的内边距
    self.titleEdgeInsets = UIEdgeInsetsMake(0, -imageWidth02, 0, imageWidth02);
    // 设置 imageView 的内边距
    self.imageEdgeInsets = UIEdgeInsetsMake(0, labelWidth02, 0, -labelWidth02);
    
}
-(void)creatBottomTextAboveButton:(NSString *)buttonText butttonClolr:(UIColor *)buttoncolor ButtonFont:(CGFloat)buttonfont imageName:(NSString *)imagename{
    
    
   
   
   
    
}
@end
